home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1998 July / EnigmA AMIGA RUN 29 (1998)(G.R. Edizioni)(IT)[!][issue 1998-07 & 08].iso / earcd / phase5 / ppcrelease / examples / tasksignaltest.c < prev    next >
C/C++ Source or Header  |  1998-02-21  |  2KB  |  68 lines

  1. #include <exec/types.h>
  2. #include <exec/nodes.h>
  3. #include <exec/lists.h>
  4. #include <exec/memory.h>
  5. #include <powerup/ppclib/interface.h>
  6. #include <powerup/gcclib/powerup_protos.h>
  7.  
  8. #define    TEXT1    "PPCTask now waits for Signal %ld\nPlease use <Tools/PPCSignalTask TaskSignalTest %ld>\nto wake it up again"
  9. #define    TEXT2    "PPCTask got Signals 0x%lx\n"
  10.  
  11. int    main(void)
  12. {
  13. BPTR        MyFile;
  14. ULONG        MySignal;
  15. ULONG        DataArray[10];
  16. ULONG        TextBuffer[500];
  17. ULONG        Length;
  18.  
  19.   if (MyFile=PPCOpen("con:0/0/640/200/TaskSignalTest/CLOSE",MODE_NEWFILE))
  20.   {
  21.     if ((MySignal=PPCAllocSignal(-1)) != -1)
  22.     {
  23.       DataArray[0]    =    MySignal;
  24.       DataArray[1]    =    MySignal;
  25.       PPCRawDoFmt(TEXT1,
  26.                   &DataArray,
  27.                   0,                /* 0=Buffer,1=serial,? NOT supported yet */
  28.                   &TextBuffer);
  29.  
  30.       Length=strlen(&TextBuffer);
  31.  
  32.       PPCWrite(MyFile,
  33.                &TextBuffer,
  34.                Length);
  35.  
  36.       DataArray[0]    =    PPCWait(1<<MySignal);
  37.  
  38.       PPCRawDoFmt(TEXT2,
  39.                   &DataArray,
  40.                   0,                /* 0=Buffer,1=serial,? NOT supported yet */
  41.                   &TextBuffer);
  42.  
  43.       Length=strlen(&TextBuffer);
  44.  
  45.       PPCWrite(MyFile,
  46.                &TextBuffer,
  47.                Length);
  48.  
  49.       PPCFreeSignal(MySignal);
  50.     }
  51.     else
  52.     {
  53.       PPCRawDoFmt("Couldn`t alloc the WakeUP Task signal\n",
  54.                   &DataArray,
  55.                   1,                /* 0=Buffer,1=serial <> NOT supported yet */
  56.                   NULL);
  57.     }
  58.     PPCClose(MyFile);
  59.   }
  60.   else
  61.   {
  62.     PPCRawDoFmt("Couldn`t open CLI Window\n",
  63.                 &DataArray,
  64.                 1,                /* 0=Buffer,1=serial <> NOT supported yet */
  65.                 NULL);
  66.   }
  67. }
  68.